Conversation
Akseonov
reviewed
Mar 30, 2022
Akseonov
left a comment
There was a problem hiding this comment.
все отлично, хорошее выполнение домашнего задания.
Comment on lines
+26
to
+34
| function func(a, b){ | ||
| if (a>=0 && b>=0){ | ||
| return a - b | ||
| }else if (a<0 && b<0) { | ||
| return a*b | ||
| } else if (a<0 && b>=0 || a>=0 && b<0){ | ||
| return a+b | ||
| } | ||
| } |
There was a problem hiding this comment.
все хорошо, задача выполнена, просто говорю как можно улучшить читаемость когда)
function func(a, b){
if (a>=0 && b>=0){
return a - b
}
if (a<0 && b<0) {
return a*b
}
return a+b
}
Comment on lines
+89
to
+92
| case (operation == '+'): return arg1 + arg2 | ||
| case (operation == '-'): return arg1 - arg2 | ||
| case (operation == '*'): return arg1 * arg2 | ||
| case (operation == '/'): return arg1 / arg2 |
There was a problem hiding this comment.
тут по заданию нужно было использовать функции из 5 задания
case (operation == '+'): summ(arg1 + arg2)
| /*7 Сравнить null и 0. Объяснить результат.*/ | ||
| console.log(null == 0) | ||
| console.log(null === 0) | ||
| // null Не является числом и приведение к числу здесь не работает |
There was a problem hiding this comment.
там все чуть сложнее, если интересно, то можете почитать эту статью
https://habr.com/ru/company/ruvds/blog/337732/
Comment on lines
+109
to
+116
| function pow_(val,pow){ | ||
| if (pow == 1){return val} | ||
| else if (pow == 0) {return 1} | ||
| if (pow>0) { | ||
| return val*pow_(val, pow - 1) } | ||
| else if (pow<0){ | ||
| return 1/val * pow_(val, pow + 1) } | ||
| } |
There was a problem hiding this comment.
тут тоже можно улучшить читабельность
function pow_(val,pow){
if (pow == 1) {
return val
}
if (pow == 0) {
return 1
}
if (pow>0) {
return val*pow_(val, pow - 1)
}
if (pow<0) {
return 1/val * pow_(val, pow + 1)
}
}
There was a problem hiding this comment.
молодец, что реализовал еще и функционал для отрицательных значений степени
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.